<template>
  <div class="goods" @click="goodsDetail" :style="parentStyle" :data-id="item.id">
    <div class="picture"><img v-lazy="{src:item.image[640],loading:lazyPic}" alt=""></div>
    <div class="title">{{item.name}}</div>
    <div class="price">
      <span class="curr"><i class="dollar">￥</i><i>{{item.price.flash}}</i></span>
      <span class="saled" v-if="item.price.vip">
        <span class="text">SVIP</span>
        <span class="price"><i>￥</i>{{item.price.vip}}</span>
      </span>
    </div>
  </div>
</template>

<script>
  export default {
    props:['parentData','parentStyle'],
    data(){
      return{
        item:{},
        lazyPic:require('../../../assets/img/publicImg/loading_default.png') ,
        showDiscount:false
      }
    },
    created(){
      this.item=this.parentData
    },
    methods:{
      goodsDetail(){
        this.$emit('childEvent',this.item.id);
      }
    }
  }
</script>

<style lang="less" scoped>
.goods{
  width: 3.6rem;
  padding: 0.15rem;
  font-family: '微软雅黑';
  background: #fff;
  margin: 0 0.08rem 0.1rem 0;
  font-size: 0.26rem;
  box-sizing: border-box;
  position: relative;
  &:nth-child(2n){
    margin-right: 0 ;
  }
  .picture{
    width: 100%;
    padding-top: 100%;
    position: relative;
    img{
      width: 100%;height: 100%;
      position: absolute;
      top: 0;left: 0;
    }
  }
  .title{
    height: 0.6rem;
    color: #333;
    line-height: 0.3rem;
    font-size: 0.24rem;
    overflow: hidden;
  }
  .price{
    line-height: 0.36rem;
    padding-top: 0.12rem;
    color: #000;
    .curr{
      font-family: '微软雅黑';
      i{
        font-size: 0.32rem;
        font-weight: 600;
        font-style: normal;
      }
      .dollar{font-size: 0.24rem;}
    }
    .saled{
      float: right;
      color: #fff;
      height: 0.32rem;
      font-size: 0.2rem;
      border-radius: 0.28rem;
      background: #FF5938;
      .text{
        display: inline-block;
        padding: 0 0.06rem;
        font-family: '微软雅黑';
        line-height: 0.38rem;
        border-right: 0.02rem solid #ffffff;
        position: relative;
        top: -0.02rem;
      }
      .price{
        color: #fff;
        font-size: 0.22rem;
        padding-right: 0.12rem;
        position: relative;
        font-family: '微软雅黑';
        top: -0.02rem;
      }
      i{
        font-size: 0.18rem;
        font-style: normal;
      }
    }
  }
  .btn{
    width: 1.2rem;height: 0.4rem;
    color: #fff;
    border-radius: 0.06rem;
    line-height: 0.4rem;
    font-size: 0.2rem;
    text-align: center;
    position: absolute;
    bottom: 0.15rem;right: 0.15rem;
    background: #D21D3D;
  }
}
</style>